﻿namespace RuoVea.Notes.Server.Models;

/// <summary>
/// 笔记
/// </summary>
[SugarTable(nameof(NtNote), "笔记")]
public class NtNote : EntityBase
{
    /// <summary>
    /// 分类ID
    /// </summary>
    [SugarColumn(ColumnDescription = "分类ID")]
    public long CategoryId { get; set; }

    /// <summary>
    /// 标题
    /// </summary>
    [Required, MaxLength(255)]
    [SugarColumn(ColumnDescription = "标题")]
    public string Title { get; set; }

    /// <summary>
    /// 内容
    /// </summary>
    [SugarColumn(ColumnDescription = "内容", ColumnDataType = StaticConfig.CodeFirst_BigString)]
    public string Content { get; set; }


    /// <summary>
    /// 笔记与标签关联
    /// </summary>
    [SugarColumn(IsIgnore = true)]
    [Navigate(NavigateType.OneToMany, nameof(NtNoteTag.NoteId), nameof(Id))]
    public List<NtNoteTag> NoteTags { get; set; }
    /// <summary>
    /// 标签
    /// </summary>
    [SugarColumn(IsIgnore = true)] 
    public List<NtTag> Tags { get; set; }

    /// <summary>
    /// 标签Id
    /// </summary>
    [SugarColumn(IsIgnore = true)]
    public List<long> TagIds { get; set; }
    /// <summary>
    /// 笔记与分类关联
    /// </summary>
    [SugarColumn(IsIgnore = true)]
    [Navigate(NavigateType.OneToMany, nameof(NtCategory.Id), nameof(CategoryId))]
    public List<NtCategory> Categorie { get; set; }
}
